
<div id="content">
<div id="main">
<div id="path"><a href="/">首页</a> &gt; <?php echo $$this->Html->link$serie['name'],'/books/serie/'.$serie['id']);?>&nbsp;
&gt; <span><?php echo $book['Book']['title'];?></span></div>
<div id="book_info"><?php echo $this->Html->image($image->thumbnail($book['Book']['id'],$book["Book"]["path"]."/cover.jpg",'300*420',100,0),array('alt'=>$book["Book"]["title"])); ?>
<h1><?php echo $book['Book']['title'];?></h1>
<em><?php echo $time->format('Y-m-d',$book["Book"]["timestamp"])?>更新</em>
<dl>
	<dt>作者:</dt>
	<dd><?php if( count($book["Authors"]) > 0 ){
				foreach( $book["Authors"] as $author){
					echo $author["name"];
				}
			}
			?></dd>
	<dt>出版社:</dt>
	<dd><?php echo $book["Publishers"][0]["name"];?></dd>
	<dt>出版时间:</dt>
	<dd><?php echo $time->format('Y-m-d',$book["Book"]["pubdate"])?></dd>
	<?php if( count($book["Identifiers"]) > 0 ){?>
	<dt>ISBN:</dt>
	<dd><?php echo $book["Identifiers"][0]["val"];?></dd>
	<?php } ?>
</dl>
<div id="download" class="download"><span>直接下载:</span>
<ul>
	 <?php if( count($book["Datas"])> 0 ){
					foreach( $book["Datas"] as $data ){
						if( $data["format"] != "MBP" )?>
						<li><?php echo $html->l$this->Html->linkformat"], 
							"#", array('class'=>'download '.$data['format'],'onclick'=>"download('".$data['format']."')"))."(".(int)((int)$data['uncompressed_size']/1024)."K)"	;?>
							</li>
						<?php
					}
				}?>
</ul>
<em><input type="checkbox" tabindex="3" id="share_check">同时分享到新浪微博</em>
</div>
<div id="download_kindle" class="download"><span>发送到Kindle:</span>
<ul>
	 <?php if( count($book["Datas"])> 0 ){
					foreach( $book["Datas"] as $data ){
						if( ($data["format"] == "AZW" || $data["format"] == "MOBI"  || $data["format"] == "PDF") && intval($data['uncompressed_size']) <= 30000000 ){?>
						<li>
						<?php echo $html->link($$this->Html->linkt"], 
							"#",
							array('class'=>'download '.$data['format'],'onclick'=>"_gaq.push(['_trackEvent', 'SendToKindle', '".$data["format"]."', '".$book["Book"]["id"]."']); send_to_kindle('".$data["format"]."'); return false;"))."(".(int)((int)$data['uncompressed_size']/1024)."K)"	;?>
							</li>
						<?php }
					}
				}?>
</ul>
<br/><br/>
发送到: <input name="kindle.name" value="<?php if( isset($kindle_name)){ echo $kindle_name;}?>"/>@
<select name="kindle.domain">
	<option value="free.kindle.com" <?php if( isset($kindle_domain) && $kindle_domain == "free.kindle.com" ){ echo "selected";}?>>free.kindle.com</option>
	<option value="kindle.com" <?php if( isset($kindle_domain) && $kindle_domain == "kindle.com" ){ echo "selected";}?>>kindle.com</option>
</select>
<br/><br/>
<b>重要说明</b>: 请在使用发送功能之前, 将@lupinlin.com添加到您的kindle接收邮件列表中, 否则您将无法收到本书.(<a href="" target="_blank">如何添加?</a>)
</div>

</div>
<?php if( isset($books_after) || isset($books_before) ){?>
<div id="book_ref">
<h2>相关书籍:</h2>
<ul>
<?php foreach( $books_before as $b ){ ?> 
	<li>
		<?php echo $html->link($this->Html->image($image->th$this->Html->link'b']['id'],$b["b"]["path"]."/cover.jpg",'100*140',100,0),array('alt'=>$b["b"]["title"])),'/books/view/'.$b['b']['id'],array('escape'=>false)); ?>
		<span><?php echo $html->link($b["b"]["title"],'/book$this->Html->link['b']['id']);?></span>
	</li>
<?php } ?>
<?php foreach( $books_after as $b ){ ?>
	<li>
		<?php echo $html->link($this->Html->image($image->th$this->Html->link'b']['id'],$b["b"]["path"]."/cover.jpg",'100*140',100,0),array('alt'=>$b["b"]["title"])),'/books/view/'.$b['b']['id'],array('escape'=>false)); ?>
		<span><?php echo $html->link($b["b"]["title"],'/book$this->Html->link['b']['id']);?></span>
	</li>
<?php } ?>
</ul>
</div>
<?php } ?>
<div id="book_description">
	<h2>书籍简介:</h2>
	<div id="description">
	<?php if( isset($book["Comments"]) ){ 	$comment = $book['Comments']['text'];
	$comment = str_replace("SUMMARY:<br>","",$comment);  echo $comment;}?>
	</div>
</div>
<div id="book_comment">
	<h2>分享你的书摘</h2>
	<iframe width="100%" height="700" frameborder="0" scrolling="no" src="http://service.t.sina.com.cn/widget/livestream/listlive.php?width=0&height=700&uid=1658749957&skin=2&pic=1&titlebar=0&border=0&publish=1&atalk=1&recomm=0&at=0&ptopic=<?php echo urldecode($book['Book']['title'].'~读享');?>&atopic=<?php echo urldecode($book['Book']['title']);?>&colordiy=0"></iframe>
</div>

</div>
	<script language="javascript" type="text/javascript">
	function send_to_kindle( format ){
			if( <?php echo $isLogin ?> == false ){//未登录
			alert('请先登录新浪微博!');
			window.location.href = '/users/sina_login';
		}
		
		if( $('input[name="kindle.name"]').val() == "" )
		{
			alert("请输入您的Kindle邮件地址");
			$('input[name="kindle.name"]').focus();
			return;
		}
		mail = $('input[name="kindle.name"]').val() + "@" + $('select[name="kindle.domain"]').val();
		//alert(mail);
		$.post('/books/send_to_kindle',{id:<?php echo $book['Book']['id']?>, format:format, mail:mail}, function(data){
			alert(data);
		});
	}
	
	function download(format ){
		if( <?php echo $isLogin ?> == false ){//未登录
			alert('请先登录新浪微博!');
			window.location.href = '/users/sina_login';
		}
		
		_gaq.push(['_trackEvent', 'Download', format, '<?php echo $book["Book"]["id"] ?>']);
		
		if( ($("#share_check").attr("checked"))){
			_gaq.push(['_trackEvent', 'Share', format, '<?php echo $book["Book"]["id"] ?>']);
			window.location.href = '/books/download/<?php echo $book['Book']['id']?>/' + format;
		} 
		else{
			window.location.href = '/books/download/<?php echo $book['Book']['id']?>/' + format+"?no_weibo=1";
		}
			
	}
	</script>